<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'down.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="lzm/js/jquery.cookie.js"></script>
<script type="text/javascript" src="lzm/js/ajaxUtils.js"></script>
<script type="text/javascript" language="javascript">
	$(document).ready(function () {
		//findUserInfo();
		//alert("woshi");
		findUserInfo1();
	});
	
	function findUserInfo(){	
		var timestamp = Date.parse(new Date());
		$.get("admin/UserServ_findUserInfo.action?ts="+timestamp,null,findUserInfoRst);
	}
	
	function findUserInfoRst(data){
		if(data.ajaxRst=="success"){
			$('#adminSP').text(data.tbUser.UName);
		}
	}
	function findUserInfo1(){	
		var timestamp = Date.parse(new Date());
		$.get("admin/UserServ_findUserInfo.action?ts="+timestamp,null,findUserInfoRst1);
	}
	
	
	
	function findUserInfoRst1(data){
		
		if(data.ajaxRst=="success"){
			//var roleList=data.tbUser.tbUserRoles[0].tbRole.RName;
			//$('#roleSP').text(roleList);
			//var roleStr="";
			//$.each(data.tbUser.tbUserRoles,function(i,n){
				//fillDatatoHTML(n.PId,n.PName,n.tbPlanGrade.pgName,n.tbPlanStatus.pstName,n.tbPlanType.ptName);
				//alert(n.tbRole.RName);
				//roleStr+=n.tbRole.RName;
				//roleStr+="、";
			//});
			//alert(data.tbUser.tbUserRoles.length);
			//alert(data.tbUser.ULoginTime);
			$('#adminSP').text(data.tbUser.UName);
			setCookie("UName",data.tbUser.UName);
			//setCookie("tbUserRoles",data.tbUser.tbUserRoles);
			//alert("ggggggggggg");
			$('#ipSP').text(data.tbUser.c);
			$('#loginSP').text(data.tbUser.ULoginTime.replace(/T/," "));
			var uRoles=new Array();
			var roleArray55=new Array(data.tbUser.tbUserRoles.length);
			var cnt=0;
			$.each(data.tbUser.tbUserRoles,function(i,n){	
				//alert(data.tbUser.tbUserRoles.length);	
				//roleArray55.push(i,n.tbRole.RName);	
					/*
				if(checkFun(roleArray55,n.tbRole.RName)){
					alert(n.tbRole.RName);						
					uRoles[cnt] = "  "+n.tbRole.RName ;
					cnt++;
				}	*/
				//roleArray55.push(n.tbRole.RName);
				/*
				if(n.tbRole.RName){
					setCookie("UName",data.tbUser.UName);
				}*/		
				
				var tag=0;
				for(var k=0;k<roleArray55.length;k++){
					if(roleArray55[k]==n.tbRole.RName){
						tag=1;
						break;
					}
				}
				if(tag==0){
					uRoles[cnt] = "  "+n.tbRole.RName ;
					roleArray55.push(n.tbRole.RName);
					cnt++;
				}
				tag=0;
			});
			
			var strhtml="";
			strhtml+=uRoles;
			$('#roleSP').text(strhtml);
			//setCookie("role",strhtml);
			/**
			 * 下面是显示部门的信息
			 */
			//alert(data.tbUser.tbUserDepts.length);
			var uDepts=new Array(data.tbUser.tbUserDepts.length);
			$.each(data.tbUser.tbUserDepts,function(i,n){
				//alert(n.tbUserDepts.udName);
				uDepts[i] = "  "+n.udName ;
			});
			var strhtml1="";
			strhtml1+=uDepts;
			$('#deptSP').text(strhtml1);
			/**
			 * 获取指挥长事件
			 */
			//var eventZhz=new Array(data.tbUser.tbUserDepts.length);
			//alert(data.tbUser.tbUserRoles.tbEvent);
			var eventZhz="";
			var tag55="0";
			$.each(data.tbUser.tbUserRoles,function(i,n){
				//if(n.tbEvent.EId!=null&&n.tbEvent.EId!="");
				if(n.tbEvent!=null){
					if(tag55=="0"){
						eventZhz=n.tbEvent.EId;
						tag55="1";
					}else{
						eventZhz=eventZhz+","+n.tbEvent.EId;
					}
				}
			});
			//var eventZhzHtml="";
			//eventZhzHtml+=eventZhz;
			//alert(eventZhz);
			setCookie("eventArr",eventZhz);
			//alert(eventZhzHtml+"eventZhzHtml");
			//$('#deptSP').text(strhtml1);
		}
	}
</script>
  <style type="text/css">

body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #06527d;
	font-size: 12px;
	
	
	
}
 .code  
         {  
             background-image:url(code.jpg);  
            font-family:Arial;  
             font-style:italic;  
             color:Red;  
             border:0;  
             padding:2px 3px;  
             letter-spacing:3px;  
             font-weight:bolder;  
         }  
         .unchanged  
         {  
            border:0;  
         }  
</style>

</head>
  
  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="24" background="images/main_47.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="29" height="24"><img src="images/main_45.gif" width="29" height="24" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="169"><span class="STYLE1">版本 2010V1.0 </span></td>
            <td width="1414" class="STYLE1">
            	欢迎您：<span class="STYLE1" id="adminSP"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所属角色：<span class="STYLE1" id="roleSP"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所属部门：<span class="STYLE1" id="deptSP"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;登录时间：<span class="STYLE1" id="loginSP"></span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;登录IP：<span class="STYLE1" id="ipSP"></span>
            </td>
            <td width="5" nowrap="nowrap" class="STYLE1"><div align="center" style="display:none"><img src="images/main_51.gif" width="12" height="12" /> 如有疑问请与技术人员联系</div></td>
          </tr>
        </table></td>
        <td width="14"><img src="images/main_49.gif" width="14" height="24" /></td>
      </tr>
    </table></td>
  </tr>
</table>
  </body>
</html>
